#!/user/bin/python
# -*- coding: utf-8 -*-
'''
 @Time    : 2018/5/2 23:00
 @File    : run.py
 @desc    :
'''
from commonSpiders.creeper.manager.manager import CrawlerProcessManager
from commonSpiders.creeper.net.business_namespace import CrawlerProcessNamespace, ClientSystemInfo, TaskNamespace
from commonSpiders.creeper.net.crawler_run import CrawlerRun
from commonSpiders.creeper.service.crawler_task_service import CrawlerTaskService
from commonSpiders.creeper.service.service import ClientCrawlerProcessManagerService
from commonSpiders.net.client.client import Client

if __name__ == '__main__':
    import sys
    reload(sys)
    sys.setdefaultencoding('utf8')

    client = Client()
    client.set_namespace(CrawlerProcessNamespace.KEY, CrawlerProcessNamespace)
    client.set_namespace(ClientSystemInfo.KEY, ClientSystemInfo)
    client.set_namespace(TaskNamespace.KEY, TaskNamespace)
    CrawlerRun(client, [CrawlerProcessManager(), ClientCrawlerProcessManagerService(), CrawlerTaskService()]).run()